package com.clement.spring.study.model;

import org.apache.commons.lang3.builder.Builder;
import org.joda.time.DateTime;

import java.util.Date;

/**
 * This is for showing the personBuilder
 */

public class PersonBuilder implements Builder<Person> {
    private Person person;

    public PersonBuilder(String personName) {
        person = new Person();
        person.setName(personName);
    }

    public PersonBuilder withAge(int age) {
        person.setAge(age);
        return this;
    }

    public PersonBuilder withDate(Date date) {
        person.setLoginDateTime(date);
        return this;
    }

    @Override
    public Person build() {
        return this.person;
    }
}
